#include <iostream>
#include "/usr/local/mysql/include/mysql.h"
#include <string.h>


MYSQL my_connect(){
    MYSQL conn;
    int res;
    mysql_init(&conn);
    const char* host = "127.0.0.1";
    const int   port = 3306;
    const char* username = "root";
    const char* password = "123456";
    const char* dbname = "test";

    if(mysql_real_connect(&conn, host, username, password, dbname, port, NULL, CLIENT_FOUND_ROWS)){
        
        std::cout << "connect success" << std::endl;
    }else{
        printf("%s\n", mysql_error(&conn));
        std::cout << "connect error" << std::endl;
    }
//    mysql_close(&conn);

    return conn;
}